package com.gzy.xuexiziliao.mapper;


import com.gzy.xuexiziliao.pojo.entity.Information;
import com.gzy.xuexiziliao.pojo.entity.Student;
import org.apache.ibatis.annotations.*;

import java.time.LocalDate;
import java.util.List;
import java.util.Map;

@Mapper
public interface StudentMapper {

    void save(Student student);

    void delete(List<Integer> ids);

    void update(Student student);


    @Select("select * from student where student_id = #{studentId}")
    Student getById(Integer id);

    /**
     * 根据OpenId查询
     */
    @Select("select * from student where openid = #{openid}")
    Student getByOpenId(String openid);


    List<Student> list(String name, Short gender, LocalDate begin, LocalDate end);

    Integer countByMap(Map map);



    List<Student> getByName(String name);



    void UpdateUserInfo(Student student);

    @Select("select * from student where student_id = #{studentId}")
    Student getStatusByStudentId(Student student); // 明确返回Integer类型



    List<Information> informationlist(
            @Param("name") String name,
            @Param("gender") Short gender,
            @Param("begin") LocalDate begin,
            @Param("end") LocalDate end,
            @Param("status") Short status);

    @Select("select * from information where status = #{status}")
   int checkinformationstatus(int informationListList);

    @Insert("insert into health_records (student_id) values (#{studentId})")
    void addStudentId(int studentId);
    @Insert("insert into review (student_id) values (#{studentId})")
    void addStudentIdByReview(int studentId);
    @Select("select phone_number from student where student_id = #{id}")
    String getPhone(Integer id);
}
